<?php
/**
 * Represents a single/stacked item.
 *
 * @author Mark Dohmen.
 */
final class Item extends Entity {
	
	/**
	 * The amount of this item.
	 */
	private $count;
	
	/**
	 * Global information about the item.
	 */
	private $itemDefinition;
	
	/**
	 * Class Constructor..
	 *
	 * @param $id
	 * @param $itemDefinition
	 * @param $count
	 */
	final public function Item(ItemDefinition $itemDefinition, int $count = 1) {
		$this->count = $count;
		$this->itemDefinition = $itemDefinition;
	}
	
	/**
	 * Gets the item definition.
	 *
	 * @return $itemDefinition
	 */
	final public function getDefinition() {
		if ($this->itemDefinition instanceof ItemDefinition) {
			return (object) $this->itemDefinition;
		}
		return NULL;
	}
	
	/**
	 * Sets the amount of this item.
	 *
	 * @param $count
	 */
	final public function setCount(int $count) {
		$this->count = $count;
	}
	
	/**
	 * Gets the amount of this item.
	 *
	 * @return $count
	 */
	final public function getCount() {
		return (int) $this->count;
	}
}
?>